package com.service.impl;

import com.entity.Container;
import com.service.PodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import com.repository.PodRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class PodServiceImpl implements PodService {

    private PodRepository podRepository;

    @Autowired
    public PodServiceImpl(PodRepository podRepository) {
        this.podRepository = podRepository;
    }

    @Override
    public Page<Container> findAllParmas(Integer page, Integer size) {
        Sort sort = new Sort(Sort.Direction.DESC,"Id");
        Pageable pageable = PageRequest.of(size,page,sort);
        return podRepository.findAll(pageable);
    }
}

